package com.cat.momento.black_box;


/**
 * @author cat
 * @version 2025/5/28 15:36
 * @description
 * @since JDK17
 */

public class Client {
    public static void main(String[] args) {
        System.out.println("------------大战boss前-------------");
        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.stateDisplay();

        // 将角色的内部状态进行备份
        RoleStateCareTaker roleStateCareTaker = new RoleStateCareTaker();
        roleStateCareTaker.setMemento(gameRole.saveState());
        System.out.println("------------大战boss后-------------");
        gameRole.fight();
        gameRole.stateDisplay();

        System.out.println("------------恢复状态后-------------");
        gameRole.recoverState(roleStateCareTaker.getMemento());
        gameRole.stateDisplay();
    }
}
